import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class UsedAfterSalesManageService {

  serviceUrls: any = {
    queryLogisticsDetailsUrl: '/mallOrderExpress/findOrderExpress', // 查看物流详情
    querySecondAfterSaleListUrl: '/mallOrderRefund/list', // 查询二手售后单管理list
    querySecondAfterSaleDetailUrl: '/mallOrderRefund/details/', // 查询二手订单管理详情

    afterSaleHandleUrl: '/mallOrderRefund/updateOrder', // 售后处理接口(申请审核)
    updateSecondExpressUrl: '/mallOrderRefund/updateExpress', // 修改物流信息
    queryAddressListUrl: '/address/list' // 地址管理List
  };

  constructor(public httpClient: HttpClient) { }

  // 查询地址管理列表
  getAddressListData(params: any) {
    return this.httpClient.post(this.serviceUrls.queryAddressListUrl, params).toPromise();
  }

  // 查看物流详情
  getLogisticsDetails(params: any) {
    return this.httpClient.get(this.serviceUrls.queryLogisticsDetailsUrl, { params }).toPromise();
  }

  // 查询二手售后单管理list
  getSecondAfterSaleList(params: any) {
    return this.httpClient.get(this.serviceUrls.querySecondAfterSaleListUrl, { params }).toPromise();
  }

  // 查询二手订单管理详情
  getSecondAfterSaleDetails(id: any) {
    let url = `${this.serviceUrls.querySecondAfterSaleDetailUrl}${id}`;
    return this.httpClient.post(url, {}).toPromise();
  }

  // 售后处理接口
  updateAfterSaleHandleData(params: any) {
    return this.httpClient.post(this.serviceUrls.afterSaleHandleUrl, params).toPromise();
  }

  // 修改物流信息
  updateSecondExpressData(params: any) {
    return this.httpClient.post(this.serviceUrls.updateSecondExpressUrl, params).toPromise();
  }
}



